﻿@model string
<div class="main">

    <form class=" form ui-formBind" method="post" id="_form" data-source="@Model">
        <div class="form-group">
            <label class="control-label">AccessKeyId</label>
            <div class="controls">
                <input type="text" class="form-control" maxlength="18" id="AccessKeyId" name="AccessKeyId" value="@ViewBag.AccessKeyId" data-validate="dataType:'*',nullMsg:'请填写AccessKeyId!',checkUrl:'@Url.Action("CheckExists",new { id = Request.QueryString["id"],area="admin" })',checkError:'AccessKeyId已存在，请重新设置'" />
                <span class="help-block">如果webapi需要开放给外部用户访问，建议添加不同AccessKeyId，并尽可能开放最小的权限</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">AccessKeySecret</label>
            <div class="controls">
                <input type="text" class="form-control" maxlength="32" id="AccessKeySecret" name="AccessKeySecret" value="@ViewBag.AccessKeySecret" data-validate="dataType:'*',nullMsg:'请填写AccessKeySecret!'" />
                <span class="help-block">AccessKeySecret用于对webapi参数进行签名加密</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">备注</label>
            <div class="controls">
                <input type="text" id="Remark" name="Remark" class="form-control" data-validate="dataType:'*',nullMsg:'请填写备注！'" maxlength="50" />
                <input type="hidden" id="old_directory" name="old_directory" />
                <span class="help-block">仅用于对AccessKey进行标注，方便管理</span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label">权限设置</label>
            <div class="controls">
                <select id="Authorizations" name="Authorizations" class="form-control multiple-select" multiple style="display:block;height:250px;" data-source="@ViewBag.WebApiList">
                    <option value="">所有权限</option>
                </select>
                <span class="help-block">对外的AccessKey务必根据具体场景设置具体权限，按住Ctrl键可实现多选或取消选择</span>
            </div>
        </div>


        @*<div class="form-group">
            <label class="control-label" for="xuhao">序号</label>
            <div class="controls">
                <input type="text" name="xuhao" id="xuhao" maxlength="3" value="1" class="form-control form-control-xs" data-validate="dataType:'num">
                <span class="help-block"></span>
            </div>
        </div>*@

        <div class="submit-footerbar">
            <label class="control-label"></label>
            <div class="controls">
                <input type="hidden" id="Id" name="Id" />
                <input type="hidden" id="isDefault" name="isDefault" />
                <button type="button" class="btn btn-sm btn-primary ui-pagePost" data-custom-params="url:'@Url.ActionUrl()',callBack:'PostRefreshBack'" id="bt_submit">提交</button>
                <button type="button" class="btn btn-sm btn-default ui-closeDialog">关闭</button>
                <span class="help-block"></span>
            </div>
        </div>
    </form>
</div>
<script>
    $("#Authorizations").SelectBind({ dataSourceFrom: "attr" });
</script>
